package com.fit.dao.employee;

import java.util.List;

import org.apache.tapestry5.ioc.annotations.Inject;
import org.hibernate.Session;

import com.fit.entities.Employee;

public class EmployeeDAOImpl implements EmployeeDAO {

	@Inject
	private Session session;

	public boolean save(Employee employee) {
		if (employee != null) {
			session.save(employee);
			return true;
		}
		return false;
	}

	public Employee findById(Long id) {
		return (Employee) session.get(Employee.class, id);
	}

	public List<Employee> findAll() {
		return session.createCriteria(Employee.class).list();
	}

}
